# $Id: PKGBUILD 180316 2013-03-20 02:35:37Z eric $
# Maintainer: Eric Bélanger <eric@archlinux.org>

pkgname=xine-lib
pkgver=1.2.2
pkgrel=8
pkgdesc="A multimedia playback engine"
arch=('i686' 'x86_64')
url="http://www.xine-project.org"
license=('LGPL' 'GPL')
depends=('libxvmc' 'ffmpeg' 'libxinerama')
makedepends=('wavpack' 'faad2' 'libmng' 'imagemagick' 'mesa' 'libmodplug'
             'vcdimager' 'jack' 'aalib' 'libdca' 'a52dec' 'libmad'
             'libmpcdec' 'libcaca' 'libbluray' 'gnome-vfs' 'libvdpau' 'glu')
optdepends=('imagemagick: for using the imagemagick plugin' \
            'jack: for using the jack plugin' \
            'vcdimager: for using the vcd plugin' \
            'glu: for using the opengl plugin' \
            'wavpack: for using the wavpack plugin' \
            'faad2: for using the faad plugin' \
            'libmng: for using the mng plugin' \
            'aalib: for using the aalib plugin' \
            'libmodplug: for using the modplug plugin' \
            'libdca: for using the dca plugin' \
            'a52dec: for using the a52 plugin' \
            'libmad: for using the mp3 plugin' \
            'libmpcdec: for using the musepack plugin' \
            'libcaca: for using the caca plugin' \
            'libbluray: for using the bluray plugin' \
            'gnome-vfs: for using the gnome-vfs plugin' \
            'libvdpau: for using the VDPAU plugin')
options=('!libtool')
source=(http://downloads.sourceforge.net/sourceforge/xine/${pkgname}-${pkgver}.tar.xz
        xine-lib-1.2.2-ffmpeg_audio_decoder-support-new-av_decode_audio4.patch)
sha1sums=('a349cbb0b72256bb262377796a022dcf63829b4c'
          '45500eca2aa40c133e1a6e8b23dbadc4b921b11f')

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  # Fix audio decoding with newest FFmpeg
  # https://bugs.archlinux.org/task/33818
  patch -Np1 -i "$srcdir/xine-lib-1.2.2-ffmpeg_audio_decoder-support-new-av_decode_audio4.patch"

  ./configure --prefix=/usr --with-wavpack --enable-vdpau --disable-optimizations
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
}
